import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';

import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {NgZorroAntdModule, NZ_I18N, NZ_MESSAGE_CONFIG, zh_CN} from 'ng-zorro-antd';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {DatePipe, registerLocaleData} from '@angular/common';
import zh from '@angular/common/locales/zh';
import {LoginComponent} from './login/login.component';
import {PagesModule} from './pages/pages.module';
import {NoopIntereptor} from './core/itereptor/noop.intereptor';
import {SwiperPlayComponent} from './common/swiper-play/swiper-play.component';
import {SWIPER_CONFIG, SwiperConfigInterface, SwiperModule} from 'ngx-swiper-wrapper';
import {LoadingComponent} from './common/loading/loading.component';
import {LoadingServer} from './common/loading/loading.server';
import {LoginActivate} from './core/auth/login.activate';
import {RouteReuseStrategy} from '@angular/router';
import {AppReuseStrategy} from './core/AppReuseStrategy';
import {PdfJsViewerModule} from 'ng2-pdfjs-viewer';

/**
 * 消息提示全局配置
 */
const MESSAGE_CONFIG = {
    // 持续时间(毫秒)，当设置为0时不消失
    nzDuration: 3000,
    // 最大显示消息数量
    nzMaxStack: 1,
    // 鼠标移上时禁止自动移除
    nzPauseOnHover: true,
    // 动画效果开关
    nzAnimate: true,
    // 距离顶部的位置,在屏幕底部显示
    nzTop: (window.innerHeight - 70)
};


registerLocaleData(zh);
const DEFAULT_SWIPER_CONFIG: SwiperConfigInterface = {
    direction: 'horizontal',
    slidesPerView: 'auto'
};

@NgModule({
    declarations: [
        AppComponent,
        LoginComponent,
        SwiperPlayComponent,
        LoadingComponent
    ],
    imports: [
        BrowserModule,
        HttpClientModule,
        NgZorroAntdModule,
        BrowserAnimationsModule,
        SwiperModule,
        FormsModule,
        ReactiveFormsModule,
        PagesModule,
        AppRoutingModule,
        PdfJsViewerModule,

    ],
    providers: [
        // { provide: ErrorHandler, useClass: FundebugErrorHandler },
        {provide: NZ_I18N, useValue: zh_CN},
        {
            provide: NZ_MESSAGE_CONFIG, useValue: MESSAGE_CONFIG
        },
        {provide: HTTP_INTERCEPTORS, useClass: NoopIntereptor, multi: true},
        {provide: SWIPER_CONFIG, useValue: DEFAULT_SWIPER_CONFIG},
        {provide: RouteReuseStrategy, useClass: AppReuseStrategy},
        LoadingServer,
        DatePipe,
        LoginActivate],
    bootstrap: [AppComponent]
})
export class AppModule {
}
